cmake_minimum_required(VERSION 3.12)
project(test_nn)

file(GLOB ${PROJECT_NAME}_SOURCES
    "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
)

add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_SOURCES})

target_link_libraries(${PROJECT_NAME} PRIVATE
    nn
    myplugins
    nvinfer
    nvonnxparser
    cudart
    gtest
    gtest_main
)

if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
    target_include_directories(${PROJECT_NAME} PUBLIC /usr/local/cuda/targets/aarch64-linux/include)
    target_link_directories(${PROJECT_NAME} PUBLIC /usr/local/cuda/targets/aarch64-linux/lib)
    target_link_directories(${PROJECT_NAME} PUBLIC /usr/src/tensorrt/lib)
else()
    target_include_directories(${PROJECT_NAME}
        PUBLIC /usr/local/cuda/include
        PUBLIC /usr/src/tensorrt/samples/common
    )
    target_link_directories(${PROJECT_NAME} PUBLIC /usr/local/cuda/lib64)
endif()

target_include_directories(${PROJECT_NAME} PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}
    $<TARGET_PROPERTY:nn,INTERFACE_INCLUDE_DIRECTORIES>
)

add_test(test_nn test_nn)
